package spolipar.bitcoin.bot;

import java.io.IOException;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import spolipar.bitcoin.bot.data.DataFetcherTask;
import spolipar.bitcoin.bot.data.DeepData;
import spolipar.bitcoin.bot.data.LiveDataStorage;
import spolipar.bitcoin.bot.data.MarketDataType;
import spolipar.bitcoin.bot.data.Storage;
import spolipar.bitcoin.bot.data.StorageKey;
import spolipar.bitcoin.bot.data.formatter.DeepStringFormatter;

/**
 * Servlet implementation class Main
 */
@WebServlet(description = "Main servlet", urlPatterns = { "/Main" })
public class Main extends HttpServlet {

	
	public void doGet(HttpServletRequest req, HttpServletResponse resp)	throws IOException {

		
		resp.setContentType(" text/html;charset=UTF-8");
		
		Storage s = LiveDataStorage.instance().getStorage(StorageKey.BITSTAMP_MD);
		DeepData deep = null;
		if(s!=null) {
			deep = s.getDeep();
		}

			

		String deepTable = DeepStringFormatter.formatHTML(deep);
		resp.getWriter().println(deepTable);
	}
	
	

}
